package com.ssy.lingxi.purchase.api.enums.bidding;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 *列表是否显示按钮枚举类
 */
public enum BiddingButtonEnums {

    /**
     * 列表显示按钮枚举 1:显示全部; 3:显示修改; 4:显示删除; 5:显示作废; 6:显示审核; 7:显示提交审核; 8:显示提交采购竞价单;
     * 9:显示竞价管理; 10:显示提交审核竞价结果; 11:显示修改竞价结果; 12:显示审核竞价结果; 13:显示确认竞价结果 14:显示报名; 15:显示重新报名 16:显示开始竞价;
     * 采购竞价单列表
     */
    ALL(1, "显示全部按钮"),
    UPDATE(3, "显示修改"),
    DELETE(4, "显示删除"),
    CANCEL(5, "显示作废"),
    AUDIT(6, "显示审核"),
    SUBMIT_REVIEW(7, "显示提交审核"),
    SUBMIT_A_PURCHASE_BID(8, "显示提交采购竞价单"),
    BID_MANAGEMENT(9, "显示竞价管理"),
    SUBMIT_FOR_REVIEW_BIDDING_RESULTS(10, "显示提交审核竞价结果"),
    EDIT_AUCTION_RESULTS(11, "显示修改竞价结果"),
    REVIEW_AUCTION_RESULTS(12, "显示审核竞价结果"),
    CONFIRM__AUCTION_RESULTS(13, "显示确认竞价结果"),

    /**
     * 在线竞价单列表
     */
    SIGN_UP(14, "显示报名"),
    RE_SIGN_UP(15, "显示重新报名"),
    START_BIDDING(16, "显示开始竞价"),
    ;

    private Integer state;
    private String name;

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }

    BiddingButtonEnums(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public static String getName(Integer state){
        BiddingButtonEnums workEnum = Arrays.stream(BiddingButtonEnums.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(BiddingButtonEnums.class, workEnum.getState());
    }
}
